package com.example.role.web;

import com.example.role.pojo.Office;
import com.example.role.service.IOffice;
import com.example.role.service.serviceimpl.OfficeServiceImpl;
import com.example.role.util.ServerResponse;
import com.example.role.util.TableServerResponse;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 部门层，设置部门属性
 */
@RestController

public class OfficeController {
    @Autowired
    OfficeServiceImpl officeService;

    @PostMapping("addOffice")
    public Object addOffice(@RequestBody Office office){
        System.out.println("输出一下");
        return officeService.addOffice(office);

    }
    @PostMapping("/searchOffice")
    public Object searchOffice(@RequestBody Office office){

        return officeService.searchOffice(office);
    }

    @GetMapping("/deleteOfficeById/{id}")
    public Object deleteOfficeById(@PathVariable("id") String id){

        return officeService.deleteOfficeById(id);
    }

    @PostMapping("/updateOffice")
    public Object updateOffice(@RequestBody Office office){

        return officeService.updateOffice(office);

    }




//
//    /**
//     * 查询所有部门
//     */
//    @Autowired
//    IOffice ioffice;
//
//    @ApiOperation(value="获取部门列表", notes="")
//    @PostMapping("queryoffice")
//    public TableServerResponse queryOffice(Integer page,Integer limit){
//
//
//        return ioffice.queryOffice(page,limit);
//    }
//    @ApiOperation(value="增加部门", notes="根据Office对象创建部门")
//    @ApiImplicitParam(name = "office", value = "部门详细实体office", required = true, dataType = "Office")
//    @PostMapping("addOffice")
//    public ServerResponse addOffice(Office office){
//
//        return ioffice.addOffice(office);
//    }
//    @PostMapping("updaoffice")
//    public ServerResponse updateOffice(Office office){
//
//        return ioffice.updaOffice(office);
//    }
//
//    /**
//     *
//     * 删除最后配合前端在写
//     * @param ids
//     * @return
//     */
//    @PostMapping("rmOffice")
//    @ApiOperation(value="删除部门", notes="根据Office对象创建部门、")
//    @ApiImplicitParam(name = "office", value = "部门详细实体office", required = true, dataType = "Office")
//    public ServerResponse rmOffice(String ids){
//
//        return null;
//    }
//
////写一个es+mq查询search
//    @PostMapping("searchOffice")
//    public TableServerResponse searchofficeController(){
//
//        return null;
//    }

}
